#!/usr/bin/python

import os.path

from Agent import AgentInterface
from Blog import BlogInterface
from Cloud import CloudInterface
from Database import DatabaseInterface
from Repository import RepositoryInterface
from Schedule import ScheduleInterface
from Website import WebsiteInterface

"""
    This class receives configuration parameters and create interfaces for 
       different services.
"""
class Interfaces(object):
      """
          Initializes system interfaces
      """
      def __init__(self, configuration_parameters,
              agent_factory = lambda x: AgentInterface(x),
              blog_factory = lambda x: BlogInterface(x),
              cloud_factory = lambda x: CloudInterface(x),
              database_factory = lambda x: DatabaseInterface(x),
              repository_factory = lambda x: RepositoryInterface(x),
              schedule_factory = lambda x: ScheduleInterface(x),
              website_factory = lambda x: WebsiteInterface(x),
          ):
          if configuration_parameters == None:
             raise ValueError('Interfaces: unexpected None')
          self.configuration_parameters = configuration_parameters
          self.blog = blog_factory(self.configuration_parameters)
          self.cloud = cloud_factory(self.configuration_parameters)
          self.database = database_factory(self.configuration_parameters)
          self.repository = repository_factory(self.configuration_parameters)
          self.schedule = schedule_factory(self.configuration_parameters)
          self.website = website_factory(self.configuration_parameters)

##############################################################################
